home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 8 / Power CD-ROM 8.iso / windows / leddsp11 / sample.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-11-11  |  7.3 KB  |  257 lines

  1. VERSION 2.00
  2. Begin Form Sample 
  3.    Caption         =   "LED Display Sample Program"
  4.    ClientHeight    =   5436
  5.    ClientLeft      =   852
  6.    ClientTop       =   2148
  7.    ClientWidth     =   7380
  8.    Height          =   5904
  9.    Left            =   780
  10.    LinkTopic       =   "Sample"
  11.    ScaleHeight     =   453
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   615
  14.    Top             =   1752
  15.    Width           =   7524
  16.    Begin CommandButton Command13 
  17.       Caption         =   "Italics ON/OFF"
  18.       Height          =   375
  19.       Left            =   3516
  20.       TabIndex        =   14
  21.       Top             =   4884
  22.       Width           =   3735
  23.    End
  24.    Begin CommandButton Command12 
  25.       Caption         =   "Clear Display"
  26.       Height          =   255
  27.       Left            =   168
  28.       TabIndex        =   13
  29.       Top             =   5028
  30.       Width           =   2175
  31.    End
  32.    Begin CommandButton Command11 
  33.       Caption         =   "Cycle Some Colors"
  34.       Height          =   375
  35.       Left            =   3516
  36.       TabIndex        =   12
  37.       Top             =   4416
  38.       Width           =   3735
  39.    End
  40.    Begin CommandButton Command9 
  41.       Caption         =   "Set Left/Right Justify"
  42.       Height          =   372
  43.       Left            =   168
  44.       TabIndex        =   9
  45.       Top             =   3072
  46.       Width           =   2172
  47.    End
  48.    Begin Frame Frame1 
  49.       Caption         =   "Enter Text Numeric"
  50.       Height          =   1095
  51.       Left            =   108
  52.       TabIndex        =   8
  53.       Top             =   1884
  54.       Width           =   3015
  55.       Begin TextBox Text1 
  56.          Height          =   375
  57.          Left            =   240
  58.          TabIndex        =   11
  59.          Top             =   360
  60.          Width           =   1815
  61.       End
  62.       Begin CommandButton Command10 
  63.          Caption         =   "OK"
  64.          Height          =   255
  65.          Left            =   2160
  66.          TabIndex        =   10
  67.          Top             =   720
  68.          Width           =   735
  69.       End
  70.    End
  71.    Begin CommandButton Command8 
  72.       Caption         =   "Leading Zeros"
  73.       Height          =   375
  74.       Left            =   3516
  75.       TabIndex        =   7
  76.       Top             =   1908
  77.       Width           =   3735
  78.    End
  79.    Begin CommandButton Command7 
  80.       Caption         =   "Number of Digits"
  81.       Height          =   375
  82.       Left            =   3516
  83.       TabIndex        =   6
  84.       Top             =   2412
  85.       Width           =   3735
  86.    End
  87.    Begin CommandButton Command6 
  88.       Caption         =   "Digit Height"
  89.       Height          =   375
  90.       Left            =   3516
  91.       TabIndex        =   5
  92.       Top             =   2916
  93.       Width           =   3735
  94.    End
  95.    Begin CommandButton Command5 
  96.       Caption         =   "Reset Counter"
  97.       Height          =   255
  98.       Left            =   192
  99.       TabIndex        =   4
  100.       Top             =   4692
  101.       Width           =   2175
  102.    End
  103.    Begin CommandButton Command4 
  104.       Caption         =   "Toggle Unlit Semgent State"
  105.       Height          =   375
  106.       Left            =   3516
  107.       TabIndex        =   3
  108.       Top             =   3924
  109.       Width           =   3735
  110.    End
  111.    Begin CommandButton Command3 
  112.       Caption         =   "Stop Counter"
  113.       Height          =   255
  114.       Left            =   180
  115.       TabIndex        =   2
  116.       Top             =   4344
  117.       Width           =   2175
  118.    End
  119.    Begin Timer Timer1 
  120.       Left            =   -12
  121.       Top             =   -72
  122.    End
  123.    Begin CommandButton Command2 
  124.       Caption         =   "Scroll Mode"
  125.       Height          =   375
  126.       Left            =   3504
  127.       TabIndex        =   1
  128.       Top             =   3420
  129.       Width           =   3735
  130.    End
  131.    Begin CommandButton Command1 
  132.       Caption         =   "Start Counter"
  133.       Height          =   255
  134.       Left            =   180
  135.       TabIndex        =   0
  136.       Top             =   3996
  137.       Width           =   2175
  138.    End
  139.    Begin LedDisp LedDisplay1 
  140.       DigitHeight     =   38
  141.       Digits          =   6
  142.       Height          =   1632
  143.       Italic          =   1  'True
  144.       LeadingZeros    =   0
  145.       Left            =   60
  146.       Mode            =   0  'Non-Scroll
  147.       TextColor       =   &H0000FF00&
  148.       TextEntry       =   1  'Right
  149.       Top             =   144
  150.       UnlitSegments   =   1  'On
  151.       Width           =   7176
  152.    End
  153. Dim gCount As Integer
  154. Dim gColor(10) As Long
  155. Sub Command1_Click ()
  156.     timer1.Interval = 1000
  157. End Sub
  158. Sub Command10_Click ()
  159.     LedDisplay1.Text = Text1.Text
  160. End Sub
  161. Sub Command11_Click ()
  162.     Static tNdx As Integer
  163.     LedDisplay1.TextColor = gColor(tNdx)
  164.     tNdx = (tNdx + 1) Mod 10
  165. End Sub
  166. Sub Command12_Click ()
  167.     LedDisplay1.Action = 1
  168. End Sub
  169. Sub Command13_Click ()
  170.     Dim cState As Integer
  171.     cState = LedDisplay1.Italic
  172.     cState = (cState + 1) Mod 2
  173.     LedDisplay1.Italic = cState
  174. End Sub
  175. Sub Command2_Click ()
  176.     Dim strState As String
  177.     Dim nState As Integer
  178.     strState = "Off"
  179.     nState = LedDisplay1.Mode
  180.     nState = (nState + 1) Mod 2
  181.     On Error GoTo BadMode
  182.     LedDisplay1.Mode = nState
  183.     ' reset the counter, clear the display
  184.     LedDisplay1.Action = 1
  185.     gCount = 0
  186.     If (LedDisplay1.Mode = 1) Then strState = "On"
  187.     Command2.Caption = "Scroll Mode Is " & strState
  188.     Exit Sub
  189. BadMode:
  190.     MsgBox "Illegal Mode, Error " & Err
  191.     Resume Next
  192. End Sub
  193. Sub Command3_Click ()
  194.     timer1.Interval = 0
  195. End Sub
  196. Sub Command4_Click ()
  197.     Dim nState As Integer
  198.     nState = LedDisplay1.UnlitSegments
  199.     If (nState) Then nState = 0 Else nState = 1
  200.     LedDisplay1.UnlitSegments = nState
  201. End Sub
  202. Sub Command5_Click ()
  203.     gCount = 0
  204.     LedDisplay1.Number = gCount
  205. End Sub
  206. Sub Command6_Click ()
  207.     Dim nDHt As Integer
  208.     nDHt = LedDisplay1.DigitHeight
  209.     LedDisplay1.DigitHeight = (nDHt Mod 100) + 25
  210. End Sub
  211. Sub Command7_Click ()
  212.     Dim nDigits As Integer
  213.     nDigits = LedDisplay1.Digits
  214.     nDigits = ((nDigits - 1) Mod 8) + 2
  215.     LedDisplay1.Digits = nDigits
  216.     Command7.Caption = "Number of Digits-" & nDigits
  217. End Sub
  218. Sub Command8_Click ()
  219.     Dim nLZ As Integer
  220.     Dim nDigs As Integer
  221.     nDigs = LedDisplay1.Digits + 1
  222.     nLZ = LedDisplay1.LeadingZeros
  223.     nLZ = (nLZ + 1) Mod nDigs
  224.     On Error GoTo BadZero
  225.     LedDisplay1.LeadingZeros = nLZ
  226.     Command8.Caption = "Leading Zeros-" & LedDisplay1.LeadingZeros
  227.     Exit Sub
  228. BadZero:
  229.     MsgBox "Can't Set Leading Zeroes When Scrolling. Error #" & Err
  230.     Resume Next
  231. End Sub
  232. Sub Command9_Click ()
  233.     Dim nState As Integer
  234.     nState = LedDisplay1.TextEntry
  235.     nState = (nState + 1) Mod 2
  236.     LedDisplay1.TextEntry = nState
  237. End Sub
  238. Sub Form_Load ()
  239.     timer1.Interval = 1000
  240.     Me.Left = (Screen.Width - Me.Width) / 2
  241.     Me.Top = (Screen.Height - Me.Height) / 2
  242.     gColor(0) = &HFF00&
  243.     gColor(1) = &HFF0000
  244.     gColor(2) = &HFF&
  245.     gColor(3) = &HFFFF00
  246.     gColor(4) = &HFF00FF
  247.     gColor(5) = &HFF&
  248.     gColor(6) = &HFFFFFF
  249.     gColor(7) = &HFFFF&
  250.     gColor(8) = &H80FF&
  251.     gColor(9) = &HC0C0C0
  252. End Sub
  253. Sub Timer1_Timer ()
  254.     gCount = gCount + 1
  255.     LedDisplay1.Number = gCount
  256. End Sub
  257.